/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qjs.smterp.jpa;

import java.io.Serializable;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.qjs.smterp.model.Goods;

@Repository("goodsDao")
public class GoodsDaoImpl extends AbstractHibernateDAOImpl<Goods, Long> implements GoodsDao, Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected Class<Goods> getDomainClass() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Goods findByCode(String code) {
		// TODO Auto-generated method stub
		return (Goods)getSession().getNamedQuery("Goods.findByGoodsCode").setParameter("goodsCode", code).uniqueResult();
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Goods> findByAll() {
		// TODO Auto-generated method stub
		return getSession().getNamedQuery("Goods.findAll").list();
	}

	@Override
	public Goods findById(int Id) {
		// TODO Auto-generated method stub
		return (Goods)getSession().getNamedQuery("Goods.findByGoodsId").setParameter("goodsId", Id).uniqueResult();
	}
    
    
}
